﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Utility.PoolSystem;

namespace Utility.TaskSystem
{
	public static class UnityTasks
	{
		public static Task WaitSeconds (float seconds)
		{
			return new WaitSecondsTask (seconds);
		}

	
		#region task classes
		public class WaitSecondsTask : Task
		{
			float lifeTime;
			float t = 0;

			public WaitSecondsTask (float lifeTime)
			{
				this.lifeTime = lifeTime;
			}

			protected override void OnUpdate ()
			{
				if (t < lifeTime)
				{
					t += Time.deltaTime;
				}
				else
				{
					Done ();
				}
			}
		}

		
		#endregion
	}
}